package com.cpi.cornpp.grinddistributionversion.form;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import com.cpi.cornpp.grinddistributionversion.view.GrindDistributionVersionPlantGroupView;
import com.cpi.cornpp.grinddistributionversion.view.GrindDistributionVersionView;
/**
 * Grind Priority Distribution Version Form
 * @author Edgar Joao
 *
 */
public class GrindDistributionVersionForm extends ActionForm{
	private static final long serialVersionUID = -3406697956648435836L;
	private List grindDistributionVersion;
	
	public GrindDistributionVersionForm() {
		this.grindDistributionVersion = new ArrayList(0);
	}
	
	public List getGrindDistributionVersion() {
		return grindDistributionVersion;
	}

	public void setGrindDistributionVersion(List argGrindDistributionVersion) {
		grindDistributionVersion = argGrindDistributionVersion;
	}
	
	public void reset(ActionMapping mapping, HttpServletRequest request) {
		Iterator iterator = null;
		Iterator iteratorInside = null;
		GrindDistributionVersionPlantGroupView grindDistributionVersionPlantGroupView = null;
		List grindDistributionVersionViews = null;
		GrindDistributionVersionView grindDistributionVersionView = null;
		if(grindDistributionVersion!=null){
			iterator = grindDistributionVersion.iterator();
			while(iterator.hasNext()){
				grindDistributionVersionPlantGroupView = (GrindDistributionVersionPlantGroupView)iterator.next();
				grindDistributionVersionViews = grindDistributionVersionPlantGroupView.getGrindDistributionVersionCornTypeViews();
				iteratorInside = grindDistributionVersionViews.iterator();
				while(iteratorInside.hasNext()){
					grindDistributionVersionView = (GrindDistributionVersionView)iteratorInside.next();
					grindDistributionVersionView.setNewFixed(new Integer(0));
				}
			}
		}
	}
}
